package com.ucar.train.web;

import com.github.pagehelper.PageInfo;
import com.ucar.train.dto.SysLogDTO;
import com.ucar.train.service.impl.SysLogServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
/**
 * @ClassName: SysLogController
 * @Description TODO
 * @Author: Mingzhi.Xu
 * @Create: 2019-07-31 11:35
 **/

@Slf4j
@Controller
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired
    private SysLogServiceImpl sysLogService;

    @RequestMapping("/findAll")
    public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") Integer page, @RequestParam(name = "size", required = true, defaultValue = "10") Integer size) {
        ModelAndView mv=new ModelAndView();
        List<SysLogDTO> sysLogList= sysLogService.findAll(page,size);
        PageInfo pageInfo=new PageInfo(sysLogList);
        mv.addObject("pageInfo",pageInfo);
        mv.setViewName("syslog-list");
        return mv;
    }
}
